package org.homly.admin.action.product;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.homly.sql.SQLTool;

public class GetProductTypeListAction extends Action {
	
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String sql = "select * from config where config_status=1 order by config_sort_no desc";
		try {
			List<HashMap<String, String>> list = SQLTool.query(sql);
			JSONArray jsonArray = JSONArray.fromObject(list);
			response.getWriter().print(jsonArray);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
